﻿using FluentNHibernate.Mapping;
using Messenia.Data.Models;

namespace Messenia.Data.Hibernate.Map {
  public  class HumanResourceMap: ClassMap<HumanResource> {
      public HumanResourceMap() {
          Table("HumanResources");
          Id(x => x.ResourceId , "HumanResource_ID");
          Map(x => x.FirstName );
          Map(x => x.LastName );
          Map(x => x.Adress);
          Map(x => x.Phone );          
          Map(x => x.EmailAdress );          
          HasMany(x => x.GroupResource)
          .AsBag()
          .Table("groups_resources")
          .KeyColumn("HumanResource_ID")
          .KeyColumn("Group_ID").Not.LazyLoad();          

        }
      
    }
}
